package com.ruoyi.controller;

import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.service.AddDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/admin/add")
@Api(tags = "业务---添加数据")
public class AddDataApi {

    @Autowired
    private AddDataService addDataService;

    @ApiOperation("添加shp文件-支持点线面")
    @PostMapping("/addShpFile")
    @Anonymous
    public AjaxResult addShpFile(@RequestParam("shpFiles") MultipartFile[] shpFiles) {
        String wkt = addDataService.addShpFile(shpFiles);
        return AjaxResult.success(wkt);

    }

    @ApiOperation("添加GeoJson文件")
    @PostMapping("/addGeoJsonFile")
    @Anonymous
    public AjaxResult addGeoJsonFile(@RequestParam("geoJsonFile") MultipartFile geoJsonFile) {
        String wkt = addDataService.addGeoJsonFile(geoJsonFile);
        return AjaxResult.success(wkt);

    }


}







